﻿using System;

namespace AdaptiveAgents.Games
{
    /// <summary>
    /// Different kinds of games
    /// </summary>
    public enum GameType { Normal, Cyclic, RectangleTest, EpsilonTest, MDPNew, MDPNoRaise, MDPNoRaiseCompetence, MDPFindDifferent, NormalToCsv, MDP , MDPWithoutUpdateCompetance}
    
    /// <summary>
    /// Factory that creates different games
    /// </summary>
    public class GameFactory
    {

        /// <summary>
        /// Creates a game according to its type
        /// </summary>
        /// <param name="type">Type of game to create</param>
        /// <param name="env">EnvironmentType of the game</param>
        /// <param name="numOfRounds">Number of rounds</param>
        /// <returns>New created game</returns>
        public static Game create(GameType type, Environment env, int numOfRounds)
        {
            Game retGame = null;

            switch (type)
            {
                case GameType.Normal:
                    retGame = new NormalGame(env, numOfRounds);
                    break;
                case GameType.Cyclic:
                    retGame = new CyclicGame(env, numOfRounds);
                    break;
                case GameType.RectangleTest:
                    retGame = new RectangleTestGame(env, numOfRounds);
                    break;
                case GameType.EpsilonTest:
                    retGame = new EpsilonTestGame(env, numOfRounds);
                    break;
                case GameType.MDP:
                    retGame = new MDPGame_old(env, numOfRounds);
                    break;
                case GameType.MDPNoRaise:
                    retGame = new MDPGameNoRaise(env, numOfRounds);
                    break;
                case GameType.MDPNoRaiseCompetence:
                    retGame = new MDPNoRaiseCompetenceGame(env, numOfRounds);
                    break;
                case GameType.MDPFindDifferent:
                    retGame = new MDPFindDifferentGame(env, numOfRounds);
                    break;
                case GameType.NormalToCsv:
                    retGame = new NormalGameToCSV(env, numOfRounds);
                    break;
                case GameType.MDPNew:
                    retGame = new MDPGame(env, numOfRounds, true);
                    break;
                case GameType.MDPWithoutUpdateCompetance:
                    retGame = new MDPGame(env, numOfRounds, false);
                    break;

            }

            return retGame;
        }
    }
}
